//
//  TZYGoodsCell.m
//  Moment
//
//  Created by dllo on 15/12/26.
//  Copyright © 2015年 片刻. All rights reserved.
//

#import "TZYGoodsCell.h"


@interface TZYGoodsCell ()

@property (nonatomic, retain)UIImageView *headImageView;
@property (nonatomic, retain)UILabel *contentLabel;
@property (nonatomic, retain)UIImageView *buyImage;


@end


@implementation TZYGoodsCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createSubViews];
    }
    return self;
}




- (void)createSubViews
{

    // 10 + SCREEN_HEIGHT / 4 + 10 + SCREEN_HEIGHT / 4 / 4 + 10
    
    self.headImageView = [[UIImageView alloc] init];
    //self.headImageView.backgroundColor = [UIColor purpleColor];
    [self.contentView addSubview:self.headImageView];
    
    [self.headImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(@10);
        make.right.mas_equalTo(@(-20));
        make.left.mas_equalTo(@20);
        make.height.mas_equalTo(SCREEN_HEIGHT / 4);
        
    }];
    
    
    self.contentLabel = [[UILabel alloc] init];
    //self.contentLabel.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.contentLabel];
    
    [self.contentLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
        make.top.mas_equalTo(self.headImageView.mas_bottom).offset(10);
        make.right.mas_equalTo(@(-20));
        make.left.mas_equalTo(@20);
        make.height.mas_equalTo(SCREEN_HEIGHT / 4 / 4);
        
    }];

    
//    self.buyImage = [[UIImageView alloc] init];
//    self.buyImage.backgroundColor = [UIColor purpleColor];
//    [self.contentView addSubview:self.buyImage];
//    
//    [self.buyImage mas_remakeConstraints:^(MASConstraintMaker *make) {
//        make.top.mas_equalTo(self.contentLabel).offset(10);
//        make.right.mas_equalTo(@(-20));
//        make.width.mas_equalTo(@40);
//        make.height.mas_equalTo(@20);
//        
//    }];
//    
    
    
}


- (void)setGoodListModel:(TZYGoodsList *)goodListModel
{
    if (_goodListModel != goodListModel) {
        _goodListModel = goodListModel;
    }
    
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:self.goodListModel.coverimg] placeholderImage:PLACEHOLDER_IMAGE];
    self.contentLabel.text = self.goodListModel.title;
    self.contentLabel.numberOfLines = 0;
    self.contentLabel.font = [UIFont boldSystemFontOfSize:[TZYFontSize getFontSizeForMiddle]];
    
    
    
    
}



- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
